/** * 2007-2023 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@buy-addons.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author Buy-addons * @copyright 2007-2023 Buy-addons * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var requestSent = false; function ask_quote_quick_view(ob){ // Có request đang send if(requestSent == true) { return ; } requestSent =true; var id_product = jQuery(ob).attr("data-id-product"); var infor_product = jQuery("#product-details").attr("data-product"); // alert(infor_product); var session_id_doubleboo = ss_id; var qty_pro_pre = jQuery('#quantity_wanted').val(); var id_condition = 0; var data_attribute = jQuery(".input-color").attr("data-product-attribute"); var group_size = jQuery("#group_1").val(); var group_color = $("input[type='radio'][name='group["+ data_attribute +"]']:checked").val(); var combi_id = jQuery('#idCombination').attr('value'); if(combi_id == '' || combi_id === undefined){ combi_id = 0 ; if(infor_product == "" || infor_product === undefined){ infor_product = 0; jQuery.ajax({ type: 'POST',//phương thức gửi jscrossDomain: window.location.hostname, crossDomain: true, url: askquote_base_url+'index.php?controller=handidproduct&fc=module&module=askforaquotemodul', // lấy link của controller mới data: 'id_product='+id_product + '&data_attribute=' + data_attribute + '&gr_size=' + group_size + '&gr_color=' + group_color + '&session_id=' + session_id_doubleboo + '&id_condition=' + id_condition + '&id_combination=' + combi_id + '&qty_product_pre=' + qty_pro_pre + '"e_token=' + token_askaquotemodule + '&ajax=1', // lấy dữ liệu từ id product ở trên định nghĩa dataType:"json", success: function(jsonData,textStatus,jqXHR) { requestSent = false; updateQuote(jsonData); window.parent.$(".td_dp_popup").css("display", "block"); window.parent.$(".background_popup").css("display", "block"); window.parent.$("#header").css("z-index", "9000"); if(num_display * 1000 > 0){ setTimeout(function() { $('.td_dp_popup').fadeOut('slow'); $('.background_popup').fadeOut('slow'); }, num_display * 1000); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { console.log(errorThrown); requestSent = false; } }); } else { var parsed = JSON.parse(infor_product); var id_product_attribute = parsed.id_product_attribute; jQuery.ajax({ type: 'POST',//phương thức gửi jscrossDomain: window.location.hostname, crossDomain: true, url: askquote_base_url+'index.php?controller=handidproduct&fc=module&module=askforaquotemodul', // lấy link của controller mới data: 'id_product='+id_product + '&id_product_attribute='+id_product_attribute + '&data_attribute=' + data_attribute + '&gr_size=' + group_size + '&gr_color=' + group_color + '&session_id=' + session_id_doubleboo + '&id_condition=' + id_condition + '&id_combination=' + combi_id + '&qty_product_pre=' + qty_pro_pre + '"e_token=' + token_askaquotemodule + '&ajax=1', // lấy dữ liệu từ id product ở trên định nghĩa dataType:"json", success: function(jsonData,textStatus,jqXHR) { requestSent = false; updateQuote(jsonData); window.parent.$(".td_dp_popup").css("display", "block"); window.parent.$(".background_popup").css("display", "block"); window.parent.$("#header").css("z-index", "9000"); if(num_display * 1000 > 0){ setTimeout(function() { $('.td_dp_popup').fadeOut('slow'); $('.background_popup').fadeOut('slow'); }, num_display * 1000); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { console.log(errorThrown); requestSent = false; } }); } }else{ jQuery.ajax({ type: 'POST',//phương thức gửi jscrossDomain: window.location.hostname, crossDomain: true, url: askquote_base_url+'index.php?controller=handidproduct&fc=module&module=askforaquotemodul', // lấy link của controller mới data: 'id_product='+id_product + '&id_product_attribute='+id_product_attribute + '&gr_size=' + group_size + '&gr_color=' + group_color + '&session_id=' + session_id_doubleboo + '&id_condition=' + id_condition + '&id_combination=' + combi_id + '&qty_product_pre=' + qty_pro_pre + '"e_token=' + token_askaquotemodule + '&ajax=1', // lấy dữ liệu từ id product ở trên định nghĩa dataType:"json", success: function(jsonData,textStatus,jqXHR) { requestSent = false; updateQuote(jsonData); window.parent.$(".td_dp_popup").css("display", "block"); window.parent.$("#header").css("z-index", "9000"); window.parent.$(".background_popup").css("display", "block"); if(num_display * 1000 > 0){ setTimeout(function() { $('.td_dp_popup').fadeOut('slow'); $('.background_popup').fadeOut('slow'); }, num_display * 1000); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { requestSent = false; } }); } } function updateQuote(jsonData){ var html = ''; var html_count = ''; html_count+= ''; html_count+= ''; html_count+= ''; if(jsonData.number > 0 && jsonData.number < 2){ html_count+= ''+jsonData.number+''; } else if (jsonData.number >= 2){ html_count+= ''+jsonData.number+''; } else{ html_count+= '0'; } for(i=0;i'; html+= ''+jsonData[i].name+''; html+= ''; html+= '
'; html+= '

'+jsonData[i].name+'

';; if(jsonData[i].attr_dbboo == undefined){ html+= ' '; }else{ html+= ''+jsonData[i].attr_dbboo+''; } html+= '
'; if (jsonData.check_opt_price == 1) { html += ''+jsonData[i].price_formatted+'
'; } else { html += '' + jsonData[i].price_formatted + '
'; } html+= '
x'+jsonData[i].so_luong_sp[0]['count_product']+''; html+= '
'; html+= ''; html+= '
' html+= '
'; html+= ''; } if (jsonData.check_opt_price == 1) { html+= '
'; html+= 'Total:'; html+= ''; html+= jsonData.total_price_formatted; html+= ''; html+= '
'; } else { html+= ''; } window.parent.$(".quote_body").html(html); window.parent.$(".quotes").html(html_count); var html1 = ''; for(i=0;i'; html1+= ''; html1+= ''; html1+= ''+jsonData[i].name+''; html1+= ''; html1+= ''; html1+= ''; html1+= ''; html1+= '

'+jsonData[i].name+'

'; html1+= '
'; if(typeof jsonData[i].attribute_dbboo !== "undefined" && jsonData[i].attribute_dbboo != undefined && jsonData[i].attribute_dbboo != ''){ html1+= ''+jsonData[i].attribute_dbboo+'
'; } if (jsonData[i].reference == '') { }else{ html1+= ''+table_header_sku + ' ' +jsonData[i].reference+'
'; } html1+= ''; if (jsonData.check_opt_price == 1) { html1+= ''; html1+= jsonData[i].price_formatted; html1+= ''; } else { html1+= ''; html1+= jsonData[i].price_formatted; html1+= ''; } html1+= ''; html1+= '
'; html1+= '
'; html1+= ''; html1+= '
'; html1+= '
'; html1+= '
'; html1+= ''; html1+= '
' html1+= ''; html1+= '
'; html1+= '
'; html1+= '
'; html1+= ''; if (jsonData.check_opt_price == 1) { html1+= ''; html1+= ''+ jsonData[i].total_price_formatted+' '; html1+= ''; }else{ html1+= ''; html1+= ''+ jsonData[i].total_price_formatted +' '; html1+= ''; } html1+= ''; html1+= ''; html1+= ''; html1+= ''; } if(jsonData.number == 0){ window.parent.$(".quotes_cart_block").css("display", "none"); var html_warning_quote = ''; html_warning_quote += '
'; html_warning_quote += '

' + no_product_in_quote + '

' html_warning_quote += '
'; jQuery(".quote_body_new_dbboo").html(html_warning_quote); } if(jsonData.number > 0) { window.parent.$(".quotes_cart_block").removeAttr("style"); if (jsonData.check_opt_price == 1) { html1+= ''; html1+= '
'+cart_total_l+'
'; html1+= ''; html1+= '' + jsonData.total_price_formatted +''; html1+= ''; html1+= ''; html1+= ''; }else { html1+= ''; html1+= '
'+cart_total_l+'
'; html1+= ''; html1+= '' + jsonData.total_price_formatted +''; html1+= ''; html1+= ''; html1+= ''; } } window.parent.$(".table_body").html(html1); var html_pop = ''; html_pop+= ''; for(var i = 0; i < jsonData.number; i++){ if(jsonData.check_id_pro == jsonData[i].id && jsonData.check_id_combi == jsonData[i].id_combi_dbboo){ html_pop+= ''+jsonData[i].name+''; html_pop+= ''; html_pop += '
' + jsonData[i].name + '

'; if (jsonData.check_opt_price == 1) { html_pop += '
' + jsonData[i].price_formatted+ '
'; }else{ } if(jsonData[i].attr_dbboo == undefined){ html_pop+= '
'; }else{ html_pop+= '
Attribute: '+jsonData[i].attr_dbboo+'
'; } } } window.parent.$(".infor_product").html(html_pop); var html_right_num = ''; if(jsonData.number > 0 && jsonData.number < 2){ html_right_num+= ''+jsonData.number+''; } else if (jsonData.number >= 2){ html_right_num+= ''+jsonData.number+''; } else{ html_right_num+= ''+jsonData.number+''; } window.parent.$(".td_number_items").html(html_right_num); var html_right_pop; if (jsonData.check_opt_price == 1) { html_right_pop = jsonData.total_price_formatted; } else { html_right_pop = ''+jsonData.total_price_formatted+''; } window.parent.$(".td_price_popup").html(html_right_pop); } jQuery(document).ready(function(){ $('#fancybox-frame1520824171945').contents().find('#product').css({ display: 'none', color: 'purple' }); jQuery(".back_shopping").click(function(){ window.parent.$(".td_dp_popup").removeAttr("style"); window.parent.$(".background_popup").removeAttr("style"); }); $('.td_close').click(function() { $(".td_dp_popup").fadeOut(); window.parent.$(".td_dp_popup").removeAttr("style"); window.parent.$(".background_popup").removeAttr("style"); }); jQuery(".background_popup").click(function(){ window.parent.$(".td_dp_popup").removeAttr("style"); window.parent.$(".background_popup").removeAttr("style"); }); jQuery(".quote_cart_button").click(function(e){ if(requestSent == true) { return ; } requestSent = true; var id_product = jQuery(this).attr("data-id-product"); var session_id_doubleboo = ss_id; var qty_pro_pre = jQuery('#quantity_wanted').val(); var id_condition = 0; var data_attribute = jQuery(".input-color").attr("data-product-attribute"); var group_size = jQuery("#group_1").val(); var group_color = $("input[type='radio'][name='group["+ data_attribute +"]']:checked").val(); var combi_id = jQuery('#idCombination').attr('value'); var baseurl = window.location.hostname; if(combi_id == '' || combi_id === undefined){ combi_id = 0 ; jQuery.ajax({ type: 'POST',//phương thức gửi jscrossDomain: window.location.hostname, crossDomain: true, url: askquote_base_url+'index.php?controller=handidproduct&fc=module&module=askforaquotemodul', // lấy link của controller mới data: 'id_product='+id_product + '&data_attribute=' + data_attribute + '&gr_size=' + group_size + '&gr_color=' + group_color + '&session_id=' + session_id_doubleboo + '&id_condition=' + id_condition + '&id_combination=' + combi_id + '&qty_product_pre=' + qty_pro_pre + '"e_token=' + token_askaquotemodule + '&ajax=1', // lấy dữ liệu từ id product ở trên định nghĩa dataType:"json", success: function(jsonData,textStatus,jqXHR) { requestSent = false; updateQuote(jsonData); window.parent.$(".td_dp_popup").css("display", "block"); window.parent.$(".background_popup").css("display", "block"); window.parent.$("#header").css("z-index", "9000"); if(num_display * 1000 > 0){ setTimeout(function() { $('.td_dp_popup').fadeOut('slow'); $('.background_popup').fadeOut('slow'); }, num_display * 1000); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { requestSent = false; } }); }else{ jQuery.ajax({ type: 'POST',//phương thức gửi jscrossDomain: window.location.hostname, crossDomain: true, url: askquote_base_url + 'index.php?controller=handidproduct&fc=module&module=askforaquotemodul', // lấy link của controller mới data: 'id_product='+id_product + '&gr_size=' + group_size + '&gr_color=' + group_color + '&session_id=' + session_id_doubleboo + '&id_condition=' + id_condition + '&id_combination=' + combi_id + '&qty_product_pre=' + qty_pro_pre + '"e_token=' + token_askaquotemodule + '&ajax=1', // lấy dữ liệu từ id product ở trên định nghĩa dataType:"json", success: function(jsonData,textStatus,jqXHR) { updateQuote(jsonData); parent.jQuery.fancybox.close(); window.parent.$(".td_dp_popup").css("display", "block"); window.parent.$(".background_popup").css("display", "block"); window.parent.$("#header").css("z-index", "9000"); if(num_display * 1000 > 0){ setTimeout(function() { $('.td_dp_popup').fadeOut('slow'); $('.background_popup').fadeOut('slow'); }, num_display * 1000); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { } }); } }); jQuery(document).on('click','a.remove_btn',function(){ var id_product_rm = jQuery(this).attr("data-id-rm"); var id_condition = jQuery(this).attr("fun_delete"); var session_id_doubleboo = ss_id; var qty_pro_pre = jQuery('#quantity_wanted').val(); var id_combi_del = jQuery(this).attr("data-id-cb"); var baseurl = window.location.hostname; jQuery.ajax({ type: 'POST',//phương thức gửi jscrossDomain: window.location.hostname, crossDomain: true, url: 'index.php?controller=handidproduct&fc=module&module=askforaquotemodul', // lấy link của controller mới data:'session_id=' + session_id_doubleboo + '&id_product_remove='+id_product_rm + '&id_condition=' + id_condition +'&id_combination_rm=' + id_combi_del + '&qty_product_pre=' + qty_pro_pre + '"e_token=' + token_askaquotemodule + '&ajax=1', // lấy dữ liệu từ id product ở trên định nghĩa dataType:"json", success: function(jsonData,textStatus,jqXHR) { updateQuote(jsonData); } }); }); }); $(document).ready(function () { var myVar; myVar = setInterval(function () { var width = $(window).width(); var width_content_style = $(".td_dp_popup").outerWidth(false); var left = (parseFloat(width) - parseFloat(width_content_style)) / 2; $(".td_dp_popup").css("left", parseInt(left) + "px"); var height = jQuery(window).height(); var height_content_style = $(".td_dp_popup").outerHeight(false); var top = (parseFloat(height) - parseFloat(height_content_style)) / 2; $(".td_dp_popup").css("top", parseInt(top) + "px"); }, 100); }); /** since 1.0.38+ convert a Cart into a Quote extend code from templates/front/convert_cart.tpl **/ $(document).ready(function(){ if (typeof askforaquotemodul_convert_btn !== "undefined") { // for 1.6.x Cart page $("p.cart_navigation").append(askforaquotemodul_convert_btn); // for 1.7+ in Cart page $(".cart-grid-body, .checkout.cart-detailed-actions .text-sm-center").append(askforaquotemodul_convert_btn); // for 1.7 in checkout page $("#js-checkout-summary .cart-summary-totals").append(askforaquotemodul_convert_btn); } });